package com.qingcloud.adminbackend.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.qingcloud.adminbackend.entity.source.DataSourceDatabase;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * <p>
 * Mapper 接口
 * </p>
 *
 * @author wangjinnan
 * @since 2021-03-17
 */
@Component
public interface DatabaseMapper extends BaseMapper<DataSourceDatabase> {

    DataSourceDatabase getDatabaseByDataSourceId(@Param("dataSourceId") Integer dataSourceId);

    List<DataSourceDatabase> getDatabaseByDataSourceIds(@Param("dsIds") List<String> dsIds);

    DataSourceDatabase getDatabaseByDataSourceName(@Param("dsName") String dsName);

    int addDatabase(DataSourceDatabase database);

    int deleteDatabaseByIds(@Param("ids") List<String> ids);

    int updateDatabase(DataSourceDatabase database);

    List<DataSourceDatabase> findDatabaseByIds(@Param("ids") List<String> ids);

    List<DataSourceDatabase> findDatabaseByName(@Param("catalog") String catalog);
}
